/**
 * 翻译词典的测试单元
 */
package com.axt.dbaudit.unitTest;

import java.util.List;

import com.axt.dbaudit.bean.TransDictBean;
import com.axt.dbaudit.model.TransDict;

public class SoaTransDictTest {
	TransDictBean transDictBean;
	void test(){
		transDictBean =  new TransDictBean();
		delete();
		add();
		modify();
		query();
	}
	void add(){
		TransDict transDict = new TransDict();
		transDict.setAu_chi("test");
		transDict.setAu_eng("测试");
		if(transDictBean.add(transDict))
			System.out.println("添加成功!");
		else {
			System.out.println("添加失败!");
		}
	}
	void delete()
	{		
		if(transDictBean.delete("test"))
			System.out.println("添加成功!");
		else {
			System.out.println("添加失败!");
		}
	}
	void modify()
	{
		TransDict oTransDict = new TransDict();
		oTransDict.setAu_chi("test");
		oTransDict.setAu_eng("测试1");
		if(transDictBean.modify(oTransDict))
			System.out.println("修改成功!");
		else {
			System.out.println("修改失败!");
		}
	}
	void query()
	{
		//String sServerPath = String.format("%d", fTransDictBean.getServerId("192.168.1.212", 8000)) ;
		List<TransDict> oTransDicts = transDictBean.query();
		if(oTransDicts!=null){
		  for(int i=0; i <oTransDicts.size(); i++)
		  {
			  System.out.println("中文:"+oTransDicts.get(i).getAu_chi()+
					  "英文:"+oTransDicts.get(i).getAu_eng());
		  }
		}
		else {
			System.out.println("修改失败!");
		}
	}
  public static void main(String[] args) throws Exception
  {
	 new SoaTransDictTest().test();
  }
}
